public class Homework {
	public static void main(String[] args) {
		int i = 1;
		int endNum = 100;
		while(i <= endNum) {
			if(i % 3 == 0)
				System.out.print(i + " ");
			i++;
		}
		System.out.println();
		System.out.println();
		
		//2.
		i = 40;
		while(i <= 200) {
			if(i % 2 == 0) {
				System.out.print(i + " ");
			}
			i++;
		}
		System.out.println();
	}
}